<template>
  <figure class="movie-item">
    <img class="movie-img" :src="movie.img|transform" />
    <div class="movie-info">
      <h3>
        <figcaption>{{ movie.nm }}</figcaption>
        <mark>{{ movie.version }}</mark>
      </h3>
      <template>
        <div class="wish-container" v-if="movie.sc == 0">
          <span class="wish">{{ movie.wish }}</span
          >人想看
        </div>
        <div class="score-container" v-else>观众评<span class="score">{{ movie.sc }}</span></div>
      </template>
      <div class="actors">主演：{{ movie.star }}</div>
      <div class="broadcast">今天多少家上映</div>
    </div>
    <div class="buy-link-container">
      <a class="buy-link">购票</a>
    </div>
  </figure>
</template>

<script>
export default {
  name: "MovieItem",
  props: {
    movie: Object
  },
  filters: {
    transform: function(src) {
      return src.replace("/w.h/", "/108.160/");
    }
  }
};
</script>
<style lang="scss" scoped>
  .movie-item{
    display: flex;
    flex-direction: row;
    margin: 0;
    padding: 0;
    align-items: center;
    .movie-img{
      flex: 0;
      flex-basis: auto;
      width: 108px;
    }
    .movie-info{
      flex: 1;
      flex-basis: auto;
      padding:10px ;
      h3{
        margin: 0;
        padding: 0;
        figcaption{}
        mark{}

      }
      .wish-container{
        .wish{}
      }
      .score-container{
        .score{}
      }
      .actors{}
      .broadcast{}
    }
    .buy-link-container{
      flex: 0;
      flex-basis: auto;
      width: auto;
      display: flex;
      align-items: center;
      // 文本（中文）的换行规则
      word-break: keep-all;// keep-all不换行
      .buy-link{
        width: auto;
        display: inline-block;
      }
    }
  }
</style>
